#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int main()
{
	int a,b;int sum = 0;
	scanf("%d%d",&a,&b);
	sum = b/7*5*250;
	if(a-1+b%7<=5)
	{
		sum +=  
	}
	printf("%d",);
	return 0;
}